import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/guild_user_income_entity.dart';

GuildUserIncomeEntity $GuildUserIncomeEntityFromJson(
    Map<String, dynamic> json) {
  final GuildUserIncomeEntity guildUserIncomeEntity = GuildUserIncomeEntity();
  final List<GuildUserIncomeList>? list = (json['list'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<GuildUserIncomeList>(e) as GuildUserIncomeList)
      .toList();
  if (list != null) {
    guildUserIncomeEntity.list = list;
  }
  final String? totalSales = jsonConvert.convert<String>(json['totalSales']);
  if (totalSales != null) {
    guildUserIncomeEntity.totalSales = totalSales;
  }
  final String? totalIncome = jsonConvert.convert<String>(json['totalIncome']);
  if (totalIncome != null) {
    guildUserIncomeEntity.totalIncome = totalIncome;
  }
  final String? totalConsumeDrnIncome = jsonConvert.convert<String>(
      json['totalConsumeDrnIncome']);
  if (totalConsumeDrnIncome != null) {
    guildUserIncomeEntity.totalConsumeDrnIncome = totalConsumeDrnIncome;
  }
  final String? totalPledgeDrnIncome = jsonConvert.convert<String>(
      json['totalPledgeDrnIncome']);
  if (totalPledgeDrnIncome != null) {
    guildUserIncomeEntity.totalPledgeDrnIncome = totalPledgeDrnIncome;
  }
  final String? totalRealIncome = jsonConvert.convert<String>(
      json['totalRealIncome']);
  if (totalRealIncome != null) {
    guildUserIncomeEntity.totalRealIncome = totalRealIncome;
  }
  final String? totalMiningDrnIncome = jsonConvert.convert<String>(
      json['totalMiningDrnIncome']);
  if (totalMiningDrnIncome != null) {
    guildUserIncomeEntity.totalMiningDrnIncome = totalMiningDrnIncome;
  }
  final String? totalMiningAndPledgeIncome = jsonConvert.convert<String>(
      json['totalMiningAndPledgeIncome']);
  if (totalMiningAndPledgeIncome != null) {
    guildUserIncomeEntity.totalMiningAndPledgeIncome =
        totalMiningAndPledgeIncome;
  }
  final int? state = jsonConvert.convert<int>(json['state']);
  if (state != null) {
    guildUserIncomeEntity.state = state;
  }
  return guildUserIncomeEntity;
}

Map<String, dynamic> $GuildUserIncomeEntityToJson(
    GuildUserIncomeEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['list'] = entity.list?.map((v) => v.toJson()).toList();
  data['totalSales'] = entity.totalSales;
  data['totalIncome'] = entity.totalIncome;
  data['totalConsumeDrnIncome'] = entity.totalConsumeDrnIncome;
  data['totalPledgeDrnIncome'] = entity.totalPledgeDrnIncome;
  data['totalRealIncome'] = entity.totalRealIncome;
  data['totalMiningDrnIncome'] = entity.totalMiningDrnIncome;
  data['totalMiningAndPledgeIncome'] = entity.totalMiningAndPledgeIncome;
  data['state'] = entity.state;
  return data;
}

extension GuildUserIncomeEntityExt on GuildUserIncomeEntity {
  GuildUserIncomeEntity copyWith({
    List<GuildUserIncomeList>? list,
    String? totalSales,
    String? totalIncome,
    String? totalConsumeDrnIncome,
    String? totalPledgeDrnIncome,
    String? totalRealIncome,
    String? totalMiningDrnIncome,
    String? totalMiningAndPledgeIncome,
    int? state,
  }) {
    return GuildUserIncomeEntity()
      ..list = list ?? this.list
      ..totalSales = totalSales ?? this.totalSales
      ..totalIncome = totalIncome ?? this.totalIncome
      ..totalConsumeDrnIncome = totalConsumeDrnIncome ??
          this.totalConsumeDrnIncome
      ..totalPledgeDrnIncome = totalPledgeDrnIncome ?? this.totalPledgeDrnIncome
      ..totalRealIncome = totalRealIncome ?? this.totalRealIncome
      ..totalMiningDrnIncome = totalMiningDrnIncome ?? this.totalMiningDrnIncome
      ..totalMiningAndPledgeIncome = totalMiningAndPledgeIncome ??
          this.totalMiningAndPledgeIncome
      ..state = state ?? this.state;
  }
}

GuildUserIncomeList $GuildUserIncomeListFromJson(Map<String, dynamic> json) {
  final GuildUserIncomeList guildUserIncomeList = GuildUserIncomeList();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    guildUserIncomeList.id = id;
  }
  final String? day = jsonConvert.convert<String>(json['day']);
  if (day != null) {
    guildUserIncomeList.day = day;
  }
  final String? sales = jsonConvert.convert<String>(json['sales']);
  if (sales != null) {
    guildUserIncomeList.sales = sales;
  }
  final String? ratio = jsonConvert.convert<String>(json['ratio']);
  if (ratio != null) {
    guildUserIncomeList.ratio = ratio;
  }
  final String? income = jsonConvert.convert<String>(json['income']);
  if (income != null) {
    guildUserIncomeList.income = income;
  }
  final String? consumeDrnAmount = jsonConvert.convert<String>(
      json['consumeDrnAmount']);
  if (consumeDrnAmount != null) {
    guildUserIncomeList.consumeDrnAmount = consumeDrnAmount;
  }
  final int? consumeDrnMemberCount = jsonConvert.convert<int>(
      json['consumeDrnMemberCount']);
  if (consumeDrnMemberCount != null) {
    guildUserIncomeList.consumeDrnMemberCount = consumeDrnMemberCount;
  }
  final String? consumeDrnIncome = jsonConvert.convert<String>(
      json['consumeDrnIncome']);
  if (consumeDrnIncome != null) {
    guildUserIncomeList.consumeDrnIncome = consumeDrnIncome;
  }
  final String? consumeDrnRatio = jsonConvert.convert<String>(
      json['consumeDrnRatio']);
  if (consumeDrnRatio != null) {
    guildUserIncomeList.consumeDrnRatio = consumeDrnRatio;
  }
  final String? pledgeDrnAmount = jsonConvert.convert<String>(
      json['pledgeDrnAmount']);
  if (pledgeDrnAmount != null) {
    guildUserIncomeList.pledgeDrnAmount = pledgeDrnAmount;
  }
  final int? pledgeDrnMemberCount = jsonConvert.convert<int>(
      json['pledgeDrnMemberCount']);
  if (pledgeDrnMemberCount != null) {
    guildUserIncomeList.pledgeDrnMemberCount = pledgeDrnMemberCount;
  }
  final String? pledgeDrnIncome = jsonConvert.convert<String>(
      json['pledgeDrnIncome']);
  if (pledgeDrnIncome != null) {
    guildUserIncomeList.pledgeDrnIncome = pledgeDrnIncome;
  }
  final String? pledgeDrnRatio = jsonConvert.convert<String>(
      json['pledgeDrnRatio']);
  if (pledgeDrnRatio != null) {
    guildUserIncomeList.pledgeDrnRatio = pledgeDrnRatio;
  }
  final String? miningDrnIncome = jsonConvert.convert<String>(
      json['miningDrnIncome']);
  if (miningDrnIncome != null) {
    guildUserIncomeList.miningDrnIncome = miningDrnIncome;
  }
  final String? level1Sales = jsonConvert.convert<String>(json['level1Sales']);
  if (level1Sales != null) {
    guildUserIncomeList.level1Sales = level1Sales;
  }
  final int? level1MemberCount = jsonConvert.convert<int>(
      json['level1MemberCount']);
  if (level1MemberCount != null) {
    guildUserIncomeList.level1MemberCount = level1MemberCount;
  }
  final String? level1Ratio = jsonConvert.convert<String>(json['level1Ratio']);
  if (level1Ratio != null) {
    guildUserIncomeList.level1Ratio = level1Ratio;
  }
  final String? level1Income = jsonConvert.convert<String>(
      json['level1Income']);
  if (level1Income != null) {
    guildUserIncomeList.level1Income = level1Income;
  }
  final String? level2Sales = jsonConvert.convert<String>(json['level2Sales']);
  if (level2Sales != null) {
    guildUserIncomeList.level2Sales = level2Sales;
  }
  final int? level2MemberCount = jsonConvert.convert<int>(
      json['level2MemberCount']);
  if (level2MemberCount != null) {
    guildUserIncomeList.level2MemberCount = level2MemberCount;
  }
  final String? level2Ratio = jsonConvert.convert<String>(json['level2Ratio']);
  if (level2Ratio != null) {
    guildUserIncomeList.level2Ratio = level2Ratio;
  }
  final String? level2Income = jsonConvert.convert<String>(
      json['level2Income']);
  if (level2Income != null) {
    guildUserIncomeList.level2Income = level2Income;
  }
  final String? level3Sales = jsonConvert.convert<String>(json['level3Sales']);
  if (level3Sales != null) {
    guildUserIncomeList.level3Sales = level3Sales;
  }
  final int? level3MemberCount = jsonConvert.convert<int>(
      json['level3MemberCount']);
  if (level3MemberCount != null) {
    guildUserIncomeList.level3MemberCount = level3MemberCount;
  }
  final String? level3Ratio = jsonConvert.convert<String>(json['level3Ratio']);
  if (level3Ratio != null) {
    guildUserIncomeList.level3Ratio = level3Ratio;
  }
  final String? level3Income = jsonConvert.convert<String>(
      json['level3Income']);
  if (level3Income != null) {
    guildUserIncomeList.level3Income = level3Income;
  }
  final String? realIncome = jsonConvert.convert<String>(json['realIncome']);
  if (realIncome != null) {
    guildUserIncomeList.realIncome = realIncome;
  }
  return guildUserIncomeList;
}

Map<String, dynamic> $GuildUserIncomeListToJson(GuildUserIncomeList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['day'] = entity.day;
  data['sales'] = entity.sales;
  data['ratio'] = entity.ratio;
  data['income'] = entity.income;
  data['consumeDrnAmount'] = entity.consumeDrnAmount;
  data['consumeDrnMemberCount'] = entity.consumeDrnMemberCount;
  data['consumeDrnIncome'] = entity.consumeDrnIncome;
  data['consumeDrnRatio'] = entity.consumeDrnRatio;
  data['pledgeDrnAmount'] = entity.pledgeDrnAmount;
  data['pledgeDrnMemberCount'] = entity.pledgeDrnMemberCount;
  data['pledgeDrnIncome'] = entity.pledgeDrnIncome;
  data['pledgeDrnRatio'] = entity.pledgeDrnRatio;
  data['miningDrnIncome'] = entity.miningDrnIncome;
  data['level1Sales'] = entity.level1Sales;
  data['level1MemberCount'] = entity.level1MemberCount;
  data['level1Ratio'] = entity.level1Ratio;
  data['level1Income'] = entity.level1Income;
  data['level2Sales'] = entity.level2Sales;
  data['level2MemberCount'] = entity.level2MemberCount;
  data['level2Ratio'] = entity.level2Ratio;
  data['level2Income'] = entity.level2Income;
  data['level3Sales'] = entity.level3Sales;
  data['level3MemberCount'] = entity.level3MemberCount;
  data['level3Ratio'] = entity.level3Ratio;
  data['level3Income'] = entity.level3Income;
  data['realIncome'] = entity.realIncome;
  return data;
}

extension GuildUserIncomeListExt on GuildUserIncomeList {
  GuildUserIncomeList copyWith({
    String? id,
    String? day,
    String? sales,
    String? ratio,
    String? income,
    String? consumeDrnAmount,
    int? consumeDrnMemberCount,
    String? consumeDrnIncome,
    String? consumeDrnRatio,
    String? pledgeDrnAmount,
    int? pledgeDrnMemberCount,
    String? pledgeDrnIncome,
    String? pledgeDrnRatio,
    String? miningDrnIncome,
    String? level1Sales,
    int? level1MemberCount,
    String? level1Ratio,
    String? level1Income,
    String? level2Sales,
    int? level2MemberCount,
    String? level2Ratio,
    String? level2Income,
    String? level3Sales,
    int? level3MemberCount,
    String? level3Ratio,
    String? level3Income,
    String? realIncome,
  }) {
    return GuildUserIncomeList()
      ..id = id ?? this.id
      ..day = day ?? this.day
      ..sales = sales ?? this.sales
      ..ratio = ratio ?? this.ratio
      ..income = income ?? this.income
      ..consumeDrnAmount = consumeDrnAmount ?? this.consumeDrnAmount
      ..consumeDrnMemberCount = consumeDrnMemberCount ??
          this.consumeDrnMemberCount
      ..consumeDrnIncome = consumeDrnIncome ?? this.consumeDrnIncome
      ..consumeDrnRatio = consumeDrnRatio ?? this.consumeDrnRatio
      ..pledgeDrnAmount = pledgeDrnAmount ?? this.pledgeDrnAmount
      ..pledgeDrnMemberCount = pledgeDrnMemberCount ?? this.pledgeDrnMemberCount
      ..pledgeDrnIncome = pledgeDrnIncome ?? this.pledgeDrnIncome
      ..pledgeDrnRatio = pledgeDrnRatio ?? this.pledgeDrnRatio
      ..miningDrnIncome = miningDrnIncome ?? this.miningDrnIncome
      ..level1Sales = level1Sales ?? this.level1Sales
      ..level1MemberCount = level1MemberCount ?? this.level1MemberCount
      ..level1Ratio = level1Ratio ?? this.level1Ratio
      ..level1Income = level1Income ?? this.level1Income
      ..level2Sales = level2Sales ?? this.level2Sales
      ..level2MemberCount = level2MemberCount ?? this.level2MemberCount
      ..level2Ratio = level2Ratio ?? this.level2Ratio
      ..level2Income = level2Income ?? this.level2Income
      ..level3Sales = level3Sales ?? this.level3Sales
      ..level3MemberCount = level3MemberCount ?? this.level3MemberCount
      ..level3Ratio = level3Ratio ?? this.level3Ratio
      ..level3Income = level3Income ?? this.level3Income
      ..realIncome = realIncome ?? this.realIncome;
  }
}